POV-Ray : Newsgroups : povray.newusers : help with macro : help with macro Server Time
29 Jul 2024 06:29:14 EDT (-0400)
  help with macro  
From: mine
Date: 15 May 2006 09:00:01
Message: <web.44687a797f9206dfa533cc200@news.povray.org>
I've made a basic macro (with the help of a tutorial)that randomly places
objects (in this case spheres) in a given space. The trouble is the
tutorial didn't tell me how to stop the spheres from touching. Can anyone
help? I've included the macro below.

#declare floater = sphere{<0,.5,0>, 1}
#declare thingy_red = <1,0,0>;
#declare floater_count = 20;
#declare Locations = seed(1);
#while (floater_count > 0)
  #declare x_loc = rand(Locations)*7-1;
  #declare y_loc = rand(Locations)*7-1;
  #declare z_loc = rand(Locations)*7-1;
object{floater
      pigment{color thingy_red}
      translate <x_loc,y_loc,z_loc>
      }
  #declare floater_count = floater_count - 1;
#end


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.